<?php
/**
 * Created by PhpStorm.
 * User: kun
 * Date: 23/6/19
 * Time: 20:37
 */

namespace app\common\model;

use think\Model;

class Base extends Model
{
    protected $autoWriteTimestamp = true;

    /**
     * 新增
     * @param $data
     * @return mixed
     * @throws \Exception
     */
    public function add($data)
    {
        if (!is_array($data)) {
            exception('传输数据不合法');//抛除异常
        }
        $this->allowField(true)->save($data);
        return $this->id;
    }


}